<template>
  <div>
    <OrderTable ref="refOrderList" :statusList="statusList" :statusValue="statusValue" @submitReview="submitReview"
                @selfShipment="selfShipment"/>
  </div>
</template>

<script>
import OrderTable from "@/views/order/components/OrderTable.vue";
import {chooseSelfShipments, submitForReview} from "@/api/order/orderApi";

export default {
  name: "auditOrder",
  components: {
    OrderTable
  },
  data() {
    return {
      statusList: ['101'],
      statusValue: "101"
    }
  },
  created() {

  },
  methods: {
    // 自发货
    selfShipment(row) {
      const id = row.orderId ? row.orderId : row.toString()
      this.$confirm('是否确定将订单改为自发货状态？', '提示').then(() => {
        chooseSelfShipments({orderIds: id}).then(res => {
          this.$message.success(res.msg)
          this.$refs.refOrderList.getList()
        })
      })
    },
    // 提交待审核订单
    submitReview(row) {
      this.$confirm('是否确定提交审核订单?').then(() => {
        submitForReview({
          orderIds: row.orderId,
          erpInnerOrderStatus: 103,
          userId: this.$store.getters.userId,
          type: "1",// 0 自动化，1 手动提交
        }).then(res => {
          this.$message.success(res.msg)
          this.$refs.refOrderList.getList()
        })
      })
    },
  }
}
</script>

<style scoped>

</style>
